﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true" CodeFile="UserClass.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <div style="height: 600px">

    <br />
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

        <br />

    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" 
        EnableModelValidation="True">
        <AlternatingItemTemplate>
         <table id="Table1" runat="server" style="margin: 5px;background-color: #FAFAD2;color: #284775;width:97%; font-size: small;">
                    <tr>
                        <td valign="top" width="110">
                            <img alt="" src="<%# Eval("image")%>" style="width: 110px; height: 110px; margin: 5px" />
                        </td>
                        <td>
                            <table>
                                <tr><td>姓名:<%# Eval("name") %></td></tr>
                                <tr><td>性别:<%# Eval("sex") %></td></tr>
                                <tr><td>生日:<%# Eval("birth") %></td></tr>
                                <tr><td>电话:<%# Eval("phone") %></td></tr>
                                <tr><td>邮件:<%# Eval("email") %></td></tr>
                                <tr><td style="word-break:break-all; vertical-align: top;">地址:<%# Eval("address") %></td></tr>
                            </table>
                        </td>                        
                    </tr>
                    
                </table>       
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <span style="background-color: #FFCC66;color: #000080;">name:
            <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />
            <br />
            sex:
            <asp:TextBox ID="sexTextBox" runat="server" Text='<%# Bind("sex") %>' />
            <br />
            birth:
            <asp:TextBox ID="birthTextBox" runat="server" Text='<%# Bind("birth") %>' />
            <br />            
            phone:
            <asp:TextBox ID="phoneTextBox" runat="server" Text='<%# Bind("phone") %>' />
            <br />
            email:
            <asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
            <br />
            address:
            <asp:TextBox ID="addressTextBox" runat="server" Text='<%# Bind("address") %>' />
            <br />
            image:
            <asp:TextBox ID="imageTextBox" runat="server" Text='<%# Bind("image") %>' />
            <br />
            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
            <br /><br /></span>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <span>未返回数据。</span>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <span style="">name:
            <asp:TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>' />
            <br />sex:
            <asp:TextBox ID="sexTextBox" runat="server" Text='<%# Bind("sex") %>' />
            <br />birth:
            <asp:TextBox ID="birthTextBox" runat="server" Text='<%# Bind("birth") %>' />
            <br />phone:
            <asp:TextBox ID="phoneTextBox" runat="server" Text='<%# Bind("phone") %>' />
            <br />email:
            <asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
            <br />address:
            <asp:TextBox ID="addressTextBox" runat="server" Text='<%# Bind("address") %>' />
            <br />image:
            <asp:TextBox ID="imageTextBox" runat="server" Text='<%# Bind("image") %>' />
            <br />
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="插入" />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="清除" />
            <br /><br /></span>
        </InsertItemTemplate>
        <ItemTemplate>
 <table id="Table1" runat="server" style="margin: 5px;background-color: #FAFAD2;color: #284775;width:97%;  font-size: small;">
                    <tr>
                        <td valign="top" width="110">
                            <img alt="" src="<%# Eval("image")%>" style="width: 110px; height: 110px; margin: 5px" />
                        </td>
                        <td>
                            <table>
                                <tr><td>姓名:<%# Eval("name") %></td></tr>
                                <tr><td>性别:<%# Eval("sex") %></td></tr>
                                <tr><td>生日:<%# Eval("birth") %></td></tr>
                                <tr><td>电话:<%# Eval("phone") %></td></tr>
                                <tr><td>邮件:<%# Eval("email") %></td></tr>
                                <tr><td style="word-break:break-all; vertical-align: top;">地址:<%# Eval("address") %></td></tr>
                            
                            </table>
                        </td>                        
                    </tr>
                    
                </table>       
        </ItemTemplate>
        <LayoutTemplate>
            <div style="height: 535px;">
                
            <div ID="itemPlaceholderContainer" runat="server" 
                style="font-family: Verdana, Arial, Helvetica, sans-serif;"　>
                <span runat="server" id="itemPlaceholder" />
            </div>
            </div>
            <div style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
                <asp:DataPager ID="DataPager1" runat="server"　 PageSize="4">
                    <Fields>
                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                            ShowLastPageButton="True" />
                    </Fields>
                </asp:DataPager>
            </div>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <span style="background-color: #FFCC66;font-weight: bold;color: #000080;">name:
            <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
            <br />
            sex:
            <asp:Label ID="sexLabel" runat="server" Text='<%# Eval("sex") %>' />
            <br />
            birth:
            <asp:Label ID="birthLabel" runat="server" Text='<%# Eval("birth") %>' />
            <br />            
            phone:
            <asp:Label ID="phoneLabel" runat="server" Text='<%# Eval("phone") %>' />
            <br />
            email:
            <asp:Label ID="emailLabel" runat="server" Text='<%# Eval("email") %>' />
            <br />
            address:
            <asp:Label ID="addressLabel" runat="server" Text='<%# Eval("address") %>' />
            <br />
            image:
            <asp:Label ID="imageLabel" runat="server" Text='<%# Eval("image") %>' />
            <br />
<br /></span>
        </SelectedItemTemplate>
    </asp:ListView>

    <br />

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
        SelectCommand="SELECT [name], [sex], [birth], [phone], [email], [address], [image] FROM [member]">
    </asp:SqlDataSource>

        </div>
</asp:Content>

